package com.phrp.controller;

import com.phrp.entity.Opinion;
import com.phrp.entity.vo.OpinionSearchVO;
import com.phrp.service.OpinionService;
import com.phrp.util.returnResult.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.LinkedList;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ssc
 * @since 2024-04-20
 */
@RestController
@RequestMapping("/opinion")
public class OpinionController {

    @Autowired
    private OpinionService opinionService;

    /**
     * 获取数据
     * @return
     */
    @GetMapping(value = "getOpinionData")
    public ResponseResult getOpinionData(){
        return opinionService.getOpinionData();
    }

    /**
     * 修改数据
     * @param data
     * @return
     */
    @PostMapping(value = "submitData")
    public ResponseResult submitData(@RequestBody Opinion data){
        return opinionService.updateOpinion(data);
    }

    /**
     * 根据条件搜索内容
     * @param searchData
     * @return
     */
    @PostMapping(value = "searchData")
    public ResponseResult searchData(@RequestBody OpinionSearchVO searchData){
        return opinionService.searchData(searchData);
    }

    /**
     * 删除数据
     * @param ids
     * @return
     */
    @PostMapping(value = "deleteData")
    public ResponseResult deleteData(@RequestBody LinkedList<String> ids){
        return opinionService.deleteData(ids);
    }

}
